using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_GUAR1_STATMENTMap : EntityTypeConfiguration<SO_GUAR1_STATMENT>
    {
        public SO_GUAR1_STATMENTMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Bill_Date, t.GUARANTOR1_AMOUNT, t.SUMFIELDS });

            // Properties
            this.Property(t => t.Bill__)
                .HasMaxLength(8);

            this.Property(t => t.GUARANTOR1_CURRENCY)
                .HasMaxLength(5);

            this.Property(t => t.GUARANTOR1_ID)
                .HasMaxLength(6);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(66);

            // Table & Column Mappings
            this.ToTable("SO_GUAR1_STATMENT");
            this.Property(t => t.Bill__).HasColumnName("Bill_#");
            this.Property(t => t.Bill_Date).HasColumnName("Bill_Date");
            this.Property(t => t.GUARANTOR1_CURRENCY).HasColumnName("GUARANTOR1_CURRENCY");
            this.Property(t => t.GUARANTOR1_ID).HasColumnName("GUARANTOR1_ID");
            this.Property(t => t.GUARANTOR1_AMOUNT).HasColumnName("GUARANTOR1_AMOUNT");
            this.Property(t => t.GUARANTOR1_AMOUNT_BASE1).HasColumnName("GUARANTOR1_AMOUNT_BASE1");
            this.Property(t => t.GUARANTOR1_AMOUNT_BASE2).HasColumnName("GUARANTOR1_AMOUNT_BASE2");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
        }
    }
}
